<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
	        <!--<div class="col-sm-12">
				<label class="col-sm-3 control-label" style="line-height: 40px;">选择科目：
				</label>
				<div class="col-sm-8">
&lt;!&ndash;
					<label class="radio-box"> <input type="radio" class="form-control qk-choice" name="qdbid" value="15"/> 大学计算机基础
					</label>
					<label class="radio-box"> <input type="radio" class="form-control qk-choice" name="qdbid" value="65"/> 办公高级 </label>
&ndash;&gt;
					<label class="radio-box"> <input type="radio" class="form-control qk-choice" name="qdbid" value="24" /> C语言程序设计 </label>
					<label class="radio-box"> <input type="radio" class="form-control qk-choice" name="qdbid" value="66"/> Python语言程序设计 </label>
					&lt;!&ndash;<label class="radio-box"> <input type="radio" class="form-control qk-choice" name="qdbid" value="29"/> Java语言程序设计 </label>&ndash;&gt;
				</div>
			</div>-->
			<div class="col-sm-12">
				<label class="col-sm-3 control-label" style="line-height: 40px;">练习方式：
				</label>
				<div class="col-sm-8">
					<!--<a id="special" class="btn btn-primary btn-sm disabled" href="#" ><i class="fa fa-edit"></i> 专项练习</a>-->
					<a id="trulysim" class="btn btn-warning btn-sm " href="#" ><i class="fa fa-book"></i> 进入模拟</a>
				</div>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
		var oldksid=[[${ksid}]];//未完成的ksid
		var newksid="";
        var prefix = ctx + "exercise/";
        var qdbid=0;
		var cont=0;//默认不继续，删除后开启新的
        $(function() {
			newksid="21031323120863400";
			/*$("input.qk-choice").on('ifChecked ifUnchecked', function(event) {
				qdbid = $(this).attr("value");
				if(qdbid==24)newksid="21031323120863400";
				else if(qdbid==66)newksid="21061715024272626";
			});*/

        	if(oldksid.length>0){//有未完成的练习，要么继续，要么删除后进入新练习
				$.modal.confirm3("存在未完成的练习，继续吗？",function(){
					cont=1;
				});
			}
            //else{//没有未完成的练习，直接进入新的练习

			//}
			$("#trulysim").on("click",function(){
				$.modal.loading("正在加载数据，请稍后...");
				$.ajax({
					type: "POST",
					url: prefix + "check",
					data:{oldksid:oldksid,cont:cont,newksid:newksid},
					dataType: "json",
					success: function(ret){
						$.modal.closeLoading();
						if(ret.code == 0){
							top.location.href=ctx+ret.msg;
						}else{
							$.modal.alertWarning(ret.msg);
						}
					},
					error:function(ret){
						$.modal.closeLoading();
						$.modal.alertWarning(ret.msg);
					}
				});
			})
        });
    </script>
</body>
</html>